{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[{\"a\": 1, \"c\": 3, \"b\": 2, \"e\": 5, \"d\": 4}]\n"
     ]
    }
   ],
   "source": [
    "#!/usr/bin/python\n",
    "import json\n",
    "\n",
    "data = [ { 'a' : 1, 'b' : 2, 'c' : 3, 'd' : 4, 'e' : 5 } ]\n",
    "\n",
    "json = json.dumps(data)\n",
    "print json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{u'a': 1, u'c': 3, u'b': 2, u'e': 5, u'd': 4}\n"
     ]
    }
   ],
   "source": [
    "#!/usr/bin/python\n",
    "import json\n",
    "\n",
    "jsonData = '{\"a\":1,\"b\":2,\"c\":3,\"d\":4,\"e\":5}';\n",
    "\n",
    "text = json.loads(jsonData)\n",
    "print text"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[{\"a\":1,\"b\":2,\"c\":3,\"d\":4,\"e\":5}]\n"
     ]
    }
   ],
   "source": [
    "#!/usr/bin/python\n",
    "import demjson\n",
    "\n",
    "data = [ { 'a' : 1, 'b' : 2, 'c' : 3, 'd' : 4, 'e' : 5 } ]\n",
    "\n",
    "json = demjson.encode(data)\n",
    "print json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{u'a': 1, u'c': 3, u'b': 2, u'e': 5, u'd': 4}\n"
     ]
    }
   ],
   "source": [
    "#!/usr/bin/python\n",
    "import demjson\n",
    "\n",
    "json = '{\"a\":1,\"b\":2,\"c\":3,\"d\":4,\"e\":5}';\n",
    "\n",
    "text = demjson.decode(json)\n",
    "print  text"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
